package util;

import java.util.Iterator;
import java.util.SortedSet;

public class Compare {
	public static int sortedSets(SortedSet<? extends Comparable> s1, SortedSet<? extends Comparable> s2)  {
		Iterator<? extends Comparable> iter1 = s1.iterator();
		Iterator<? extends Comparable> iter2 = s2.iterator();
		
		while(true)  {
			if(iter1.hasNext())  {
				if(iter2.hasNext())  {
					int res = iter1.next().compareTo(iter2.next());
					if(res != 0) return res;
				}
				else return -1;
			}
			else  {
				if(iter2.hasNext()) return 1;
				else return 0;
			}	
		}
	}
}
